package com.rfs.design.templatemethod;

import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * @author: rfs
 * @create: 2021/8/17
 * @description: 普通用户购物车
 **/
@Service("NormalUserCart")
public class NormalUserCart extends AbstractCart {
    @Override
    protected CartTypeEnum getCartType(){
        return CartTypeEnum.NORMAL;
    }
    @Override
    protected void processCouponPrice(long userId, Item item) {
        item.setCouponPrice(BigDecimal.ZERO);
    }

    @Override
    protected void processDeliveryPrice(long userId, Item item) {
        System.out.print("普通用户运费计算");
        item.setDeliveryPrice(item.getPrice().multiply(BigDecimal.valueOf(item.getQuantity())).multiply(new BigDecimal("0.1")));
    }
}
